package com.example.framework509.common.entities.utils;

import javax.servlet.http.HttpServletRequest;

/**
 * @author sjh
 * @Description
 * @create 2021/9/24 17:13
 */
public class RequestInfo {

    private HttpServletRequest request;

    private String requestType;

    private long requestTime;

    private String operateType;

    @Override
    public String toString() {
        return "RequestInfo{" +
                "request=" + request +
                ", requestType='" + requestType + '\'' +
                ", requestTime=" + requestTime +
                '}';
    }

    public String getOperateType() {
        return operateType;
    }

    public void setOperateType(String operateType) {
        this.operateType = operateType;
    }

    public HttpServletRequest getRequest() {
        return request;
    }

    public void setRequest(HttpServletRequest request) {
        this.request = request;
    }

    public String getRequestType() {
        return requestType;
    }

    public void setRequestType(String requestType) {
        this.requestType = requestType;
        String opt = "";
        switch (requestType) {
            case "GET":
                opt = "获取";
                break;
            case "POST":
                opt = "创建";
                break;
            case "PUT":
                opt = "修改";
                break;
            case "DELETE":
                opt = "删除";
                break;
        }
        setOperateType(opt);
    }

    public long getRequestTime() {
        return requestTime;
    }

    public void setRequestTime(long requestTime) {
        this.requestTime = requestTime;
    }
}
